<%@page import="java.math.BigDecimal"%>
<%@page import="com.meila.cms.util.config.Property"%>
<%@page import="com.meila.cms.entity.User"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"  %> 
<%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

	User user=((User) session.getAttribute("loginUser"));

%>

<!DOCTYPE HTML>
<html lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>零件设计</title>
    
  </head>
  
  <body class="client-body">
  	<jsp:include page="../common/client-head.jsp"></jsp:include>
  	<script src="resources/js/system/partsDesign/designParts.js"></script>
  	<script src="resources/js/system/partsDesign/partDesign_list.js"></script>
  	<script src="resources/js/ajaxfileupload.js"></script>

  	<div class="client-content">
  		<jsp:include page="../common/client-leftMenu-part.jsp"></jsp:include>
  	
  		<div class="client-contentBox">
	  		<div class="cd-head">
	  			<a class="btn btn-default" href="front/partDesign/newDesign">新建设计<i class="fa fa-plus"></i></a>
	  			
	  			<div class="cd-volume">
		  			<div class="progress">
					  <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <%=user==null? "":(new BigDecimal(user.getRemianSpace()).divide(new BigDecimal(8*1024*1024),2,BigDecimal.ROUND_HALF_EVEN))+"%" %>;">
					    <span class="sr-only">30% Complete</span>
					  </div>
					</div>
					<div class="cd-volumeCount"><span>私有容量</span><%=user==null? "":(new BigDecimal(user.getRemianSpace()).divide(new BigDecimal(8*1024*1024),2,BigDecimal.ROUND_HALF_EVEN))+"%" %></div>
				</div>
  			</div>
  			
  			<div class="cd-carList">
  			<c:forEach items="${datas.datas}" var="partDesign" varStatus="status">
  				<div class="cd-listBar clearfix">
  					<div class="cd-listLeft">
  						<div class="cd-listImg"><img src="<%=Property.getProperty("FILESERVER_PATH") %>?id=${partDesign.physicalmap}"/></div>
  					</div>
  					<div class="cd-listRight">
  						<div class="cd-listTitle"><span>${partDesign.designame}</span><span><fmt:formatDate pattern="yyyy-MM-dd" value="${partDesign.createTime}" /></span></div>
  						<div class="cd-listTitle2"><span>最后修改时间：<fmt:formatDate  pattern="yyyy-MM-dd HH:mm:ss"  value="${partDesign.updateTime}" /></span></div>
  						<div class="cd-listBtns pd-listBtns btnBox clearfix">
  							<input type="hidden" id="programme${partDesign.mypartid}" value="${partDesign.programmeName}">
  							<input type="hidden" id="product${partDesign.mypartid}" value="${partDesign.productName}">
  							<input type="hidden" id="modle${partDesign.mypartid}" value="${partDesign.modleName}">
  						<c:if test="${not empty partDesign.mypartid}">
  							<a class="a-black activeBtn" href="front/partDesign/myPartDesignModify?id=${partDesign.mypartid}&partsType=${partDesign.partsType}&designid=${partDesign.id}&designame=${partDesign.designame}">修改设计</a>
  						</c:if>
  						<c:if test="${empty partDesign.mypartid}">
  							<a class="a-black activeBtn" href="front/partDesign/partDesignModify?designame=${partDesign.designame}">修改设计</a>
  						</c:if>
  							<a class="a-black" href="javascript:download('${partDesign.mypartid}');">下载</a>
  							<a class="a-black" href="javascript:showUploadModal('${partDesign.mypartid}','${partDesign.programmeid}','${partDesign.productid}','${partDesign.modleid}');">上传</a>
  						</div>
  						<a class="cd-barDel" href="javascript:del(${partDesign.id});"><i class="fa fa-times-circle-o"></i></a>
  					</div>
  				</div>
  				</c:forEach>
  				
  				<nav class="clearfix">
				
					<c:if test="${datas.total > 0}">
						<jsp:include page="/jsp/pager.jsp">
							<jsp:param value="${datas.total}" name="totalRecord"/>
							<jsp:param value="front/partDesign/partDesign_list" name="url"/>
						</jsp:include>
					</c:if>

				</nav>
  				
  			</div><!-- cd-carList -->
  		</div>
  	</div>
  	
  	<!-- Modal -->
	<div class="modal fade bs-example-modal-sm" id="loadModal" tabindex="-1" role="dialog" aria-labelledby="loadModalLabel" data-backdrop="static">
	  <div class="modal-dialog modal-sm" role="document">
	    <form action="front/partDesign/downloadFileBychose" method="post" id="downloadForm">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title">请选择所需文档</h4>
		      </div>
		      
		      <div class="modal-body load-modalBody clearfix">
		        <input name="designid"  id="designid" type="hidden"/> 
		        <label><input id="chose1" name="chose" type="checkbox" value="1" /> 2D文档 </label>
		        <label><input id="chose2" name="chose" type="checkbox" value="2" /> 3D文档 </label>
				<label><input id="chose3" name="chose" type="checkbox" value="3" /> 编程图 </label>
				<label><input id="chose4" name="chose" type="checkbox" value="4" /> 产品制作图 </label>
				<label><input id="chose5" name="chose" type="checkbox" value="5" /> 模具图 </label>
		      </div>
		      
		      <div class="modal-footer">
		      	<button type="button" class="btn btn1" onclick="submitDownload('<%=user==null? "":user.getAuthentication()%>')">确定下载</button>
		        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		      </div>
		    </div>
	     </form>
	  </div>
	</div>
	
	<!-- Modal 上传-->
	<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="uploadModalLabel" data-backdrop="static">
	  <div class="modal-dialog" role="document">
	    <form id="fileform" action="front/partDesign/update">
	    	<input type="hidden" name="programmeid" id="programmeid">
	    	<input type="hidden" name="productid" id="productid">
	    	<input type="hidden" name="modleid" id="modleid">
	    	<input type="hidden" name="id" id="partsid">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myModalLabel">上传相关图纸</h4>
		      </div>
		      
		      <div class="modal-body upload-modalBody">
		      	<div>
	        		<label>编程图</label>
	        		<div class="file-box">
						<input type="button" value="选择文件" class="file-input" onclick="flagFile.click()">
				        <input type="file" id="programmeFile" name="flagFile" style="display: none;" onchange="flagContent.value=value" >
						<input type="text" name="flagContent" style="display: none;" >
						
						<span id="programSpan" class="file-name">未上传文件</span>
					</div>
					<input class="file-submit right" type="button" value="上传" onclick="upload('编程图','programme',<%=user==null? "":user.getPhone()%>)">
		        </div>
		        <div>
	        		<label>产品制作图</label>
	        		<div class="file-box">
						<input type="button" value="选择文件" class="file-input" onclick="flagFile2.click()">
				        <input type="file" id="productFile" name="flagFile2" style="display: none;" onchange="flagContent2.value=value" >
						<input type="text" name="flagContent2" style="display: none;" >
						
						<span id="productSpan" class="file-name">未上传文件</span>
					</div>
					<input class="file-submit right" type="button" value="上传" onclick="upload('产品制作图','product',<%=user==null? "":user.getPhone()%>)">
		        </div>
		        <div>
	        		<label>模具图</label>
					<div class="file-box">
						<input type="button" value="选择文件" class="file-input" onclick="flagFile3.click()">
				        <input type="file" id="modleFile" name="flagFile3" style="display: none;" onchange="flagContent3.value=value" >
						<input type="text" name="flagContent3" style="display: none;" >
						
						<span id="modleSpan" class="file-name">未上传文件</span>
					</div>
					<input class="file-submit right" type="button" value="上传" onclick="upload('模具图','modle',<%=user==null? "":user.getPhone()%>)">
		        </div>
		        <div class="upload-modalHint" style="display: none">目前仅支持.stp格式文件上传</div>
		      </div>
		      
		      <div class="modal-footer">
		        <button type="submit" class="btn btn1">确定</button>
		        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		      </div>
		    </div>
	     </form>
	  </div>
	</div>
	
  </body>
</html>
